Skip to content

Conversation

erizzo
Copy link

@erizzo erizzo commented Jun 18, 2025

📢 Type of change

  • Bugfix
  • [x ] New feature
  • Enhancement
  • Refactoring

📜 Description

In a discussion about skipping certain @SqsListener annotation at runtime, it was suggested to provide a more convenient mechanism for applications. This is a suggested implementation of that idea.

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • [x ] I added tests to verify changes
  • I updated reference documentation to reflect the change
  • [x ] All tests passing
  • No breaking changes

🔮 Next steps

@github-actions github-actions bot added the component: sqs SQS integration related issue label Jun 18, 2025
@erizzo erizzo changed the title Add SqqListenerFilter for use by the annotation processor Add SqsListenerFilter for use by the annotation processor Jun 18, 2025
Copy link
Contributor

@tomazfernandes tomazfernandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @erizzo!

Left a few comments, let me know what you think.

@FunctionalInterface
public interface SqsListenerFilter {

boolean createEndpoint(SqsListener annotation);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps shouldCreateEndpoint?


@Override
protected Endpoint createEndpoint(SqsListener sqsListenerAnnotation) {
if (filters.stream().anyMatch(f -> !f.createEndpoint(sqsListenerAnnotation))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this logic would be better placed in the AbstractListenerAnnotationBeanPostProcessor, since it's not an SQS-specific logic.

}
annotatedMethods.entrySet().stream()
.map(entry -> createAndConfigureEndpoint(bean, entry.getKey(), entry.getValue()))
.filter(Objects::nonNull)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not filter the endpoints here, before the map method?

@tomazfernandes
Copy link
Contributor

@erizzo, we just merged a PR with a few changes to the annotation BPP, please rebase your branch and take a look at the changes.

Thanks and looking forward to seeing this feature evolve!

@tomazfernandes tomazfernandes added the status: waiting-for-feedback Waiting for feedback from issuer label Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: sqs SQS integration related issue status: waiting-for-feedback Waiting for feedback from issuer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants